package com.vegas.netspider.apps.task;

import java.util.List;

import com.vegas.netspider.apps.UrlUtil;
import com.vegas.netspider.apps.parser.WebParser;
import com.vegas.netspider.cache.RoughBetInfo;
import com.vegas.netspider.cache.footballroom.DsRoom;

public class MoreBetNetDataLoader extends NetDataLoaderProxyer{

	private String ftmoreUrl;
	
	private DsRoom ftdsRoom;
	
	private WebParser<RoughBetInfo> moreBetParser;
	
	
	public void loadFtMore() throws Exception{
		List<Integer> ids = this.ftdsRoom.listExistsMoreBetMatchId();
		if(ids==null||ids.isEmpty()){
			return;
		}
		
		for(Integer id:ids){
			if(id==null){
				continue;
			}
			String url = UrlUtil.replaceMatchId(ftmoreUrl, id);
			String resource = this.load(url);
			RoughBetInfo rbi = this.moreBetParser.parse(resource);
			ftdsRoom.pushMoreBet(rbi);			
		}
	}
	
	private String ftfmoreUrl;
	private com.vegas.netspider.cache.footballfutureroom.DsRoom ftfdsRoom;
	public void loadFtfMore() throws Exception{
		List<Integer> ids = this.ftfdsRoom.listExistsMoreBetMatchId();
		if(ids==null||ids.isEmpty()){
			return;
		}
		
		for(Integer id:ids){
			if(id==null){
				continue;
			}
			String url = UrlUtil.replaceMatchId(ftfmoreUrl, id);
			String resource = this.load(url);
			RoughBetInfo rbi = this.moreBetParser.parse(resource);
			ftfdsRoom.pushMoreBet(rbi);			
		}
	}
	public void setFtmoreUrl(String ftmoreUrl) {
		this.ftmoreUrl = ftmoreUrl;
	}
	public void setFtdsRoom(DsRoom ftdsRoom) {
		this.ftdsRoom = ftdsRoom;
	}
	public void setMoreBetParser(WebParser<RoughBetInfo> moreBetParser) {
		this.moreBetParser = moreBetParser;
	}
	public void setFtfmoreUrl(String ftfmoreUrl) {
		this.ftfmoreUrl = ftfmoreUrl;
	}
	public void setFtfdsRoom(
			com.vegas.netspider.cache.footballfutureroom.DsRoom ftfdsRoom) {
		this.ftfdsRoom = ftfdsRoom;
	}
	
	
	
}
